package com.jusfoun.communication.util;

import org.springframework.stereotype.Component;

/**
 * result生成util
 *
 * @author lcy
 *
 */
@Component
public class ResultUtil {
	/**
	 * 操作失败时的返回
	 *
	 * @param title
	 * @param msg
	 * @return
	 */
	public Result fail(String title, String msg) {
		return new Result(false, 500, title, msg, null);
	}

	/**
	 * 成功
	 * @return
	 */
	public Result success(){
		return success("成功","");
	}

	/**
	 * 操作成功时的返回数据
	 *
	 * @param title
	 * @param msg
	 * @return
	 */
	public Result success(String title, String msg) {
		return new Result(title, msg);
	}

	/**
	 * 操作成功时的返回数据
	 *
	 * @param title
	 * @param msg
	 * @param data
	 * @return
	 */
	public Result success(String title, String msg, Object data) {
		return new Result(true, 1000, title, msg, data);
	}
}
